
#include <iostream>
using namespace std;

class A {
public:
	A( int i ) : m_i( i ) {
		
	}
	operator bool( ) const {
		cout << "A'operator has been called" << endl;
		return this->m_i;
	}
private:
	int m_i;
};

// designer
// ------------------------------------------------------------------
// user

int main( void ) {
	A a( 8888 ), b( 0 );

	bool c = a;	// bool c = a.operator bool( ) -> A function
	cout << "c = " << c << endl;

	bool d;
	d = b;
	cout << "d = " << d << endl;

	if( a ) {
		cout << "if condition is ture" << endl;
	}

	while( a ) {
		cout << "while has been called" << endl;
		break;
	}

	for( ; a ; ) {
		cout << "for has been called" << endl;
		break;
	}

	cout << !a << endl;

	return 0;
}

